<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Jelly Button Animation Using GSAP</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel='stylesheet' type='text/css' media='screen' href='style.css'>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.1/gsap.min.js"></script>
</head>
<body>
<button class="button">Click me</button>
<script>
var $button = document.querySelector(".button");
$button.addEventListener("click", function () {
var duration = 0.3, delay = 0.08;
TweenMax.to($button, duration, {
scaleY: 1.6,
ease: Expo.easeOut
});
TweenMax.to($button, duration, {
scaleX: 1.2,
scaleY: 1,
ease: Back.easeOut,
easeParams: [3],
delay: delay
});
TweenMax.to($button, duration * 1.25, {
scaleX: 1,
scaleY: 1,
ease: Back.easeOut,
easeParams: [6],
delay: delay * 3
});
});
</script>
</body>
</html>